﻿using System;
using Microsoft.Xna.Framework;

namespace Terraria.World.Generation
{
	// Token: 0x020000B3 RID: 179
	public static class Searches
	{
		// Token: 0x06000A7F RID: 2687 RVA: 0x0000B469 File Offset: 0x00009669
		public static GenSearch Chain(GenSearch search, params GenCondition[] conditions)
		{
			return search.Conditions(conditions);
		}

		// Token: 0x020000B4 RID: 180
		public class Left : GenSearch
		{
			// Token: 0x06000A80 RID: 2688 RVA: 0x0000B472 File Offset: 0x00009672
			public Left(int maxDistance)
			{
				this._maxDistance = maxDistance;
			}

			// Token: 0x06000A81 RID: 2689 RVA: 0x003E6368 File Offset: 0x003E4568
			public override Point Find(Point origin)
			{
				for (int i = 0; i < this._maxDistance; i++)
				{
					if (base.Check(origin.X - i, origin.Y))
					{
						return new Point(origin.X - i, origin.Y);
					}
				}
				return GenSearch.NOT_FOUND;
			}

			// Token: 0x04000EE5 RID: 3813
			private int _maxDistance;
		}

		// Token: 0x020000B5 RID: 181
		public class Right : GenSearch
		{
			// Token: 0x06000A82 RID: 2690 RVA: 0x0000B481 File Offset: 0x00009681
			public Right(int maxDistance)
			{
				this._maxDistance = maxDistance;
			}

			// Token: 0x06000A83 RID: 2691 RVA: 0x003E63B8 File Offset: 0x003E45B8
			public override Point Find(Point origin)
			{
				for (int i = 0; i < this._maxDistance; i++)
				{
					if (base.Check(origin.X + i, origin.Y))
					{
						return new Point(origin.X + i, origin.Y);
					}
				}
				return GenSearch.NOT_FOUND;
			}

			// Token: 0x04000EE6 RID: 3814
			private int _maxDistance;
		}

		// Token: 0x020000B6 RID: 182
		public class Down : GenSearch
		{
			// Token: 0x06000A84 RID: 2692 RVA: 0x0000B490 File Offset: 0x00009690
			public Down(int maxDistance)
			{
				this._maxDistance = maxDistance;
			}

			// Token: 0x06000A85 RID: 2693 RVA: 0x003E6408 File Offset: 0x003E4608
			public override Point Find(Point origin)
			{
				for (int i = 0; i < this._maxDistance; i++)
				{
					if (base.Check(origin.X, origin.Y + i))
					{
						return new Point(origin.X, origin.Y + i);
					}
				}
				return GenSearch.NOT_FOUND;
			}

			// Token: 0x04000EE7 RID: 3815
			private int _maxDistance;
		}

		// Token: 0x020000B7 RID: 183
		public class Up : GenSearch
		{
			// Token: 0x06000A86 RID: 2694 RVA: 0x0000B49F File Offset: 0x0000969F
			public Up(int maxDistance)
			{
				this._maxDistance = maxDistance;
			}

			// Token: 0x06000A87 RID: 2695 RVA: 0x003E6458 File Offset: 0x003E4658
			public override Point Find(Point origin)
			{
				for (int i = 0; i < this._maxDistance; i++)
				{
					if (base.Check(origin.X, origin.Y - i))
					{
						return new Point(origin.X, origin.Y - i);
					}
				}
				return GenSearch.NOT_FOUND;
			}

			// Token: 0x04000EE8 RID: 3816
			private int _maxDistance;
		}

		// Token: 0x020000B8 RID: 184
		public class Rectangle : GenSearch
		{
			// Token: 0x06000A88 RID: 2696 RVA: 0x0000B4AE File Offset: 0x000096AE
			public Rectangle(int width, int height)
			{
				this._width = width;
				this._height = height;
			}

			// Token: 0x06000A89 RID: 2697 RVA: 0x003E64A8 File Offset: 0x003E46A8
			public override Point Find(Point origin)
			{
				for (int i = 0; i < this._width; i++)
				{
					for (int j = 0; j < this._height; j++)
					{
						if (base.Check(origin.X + i, origin.Y + j))
						{
							return new Point(origin.X + i, origin.Y + j);
						}
					}
				}
				return GenSearch.NOT_FOUND;
			}

			// Token: 0x04000EE9 RID: 3817
			private int _width;

			// Token: 0x04000EEA RID: 3818
			private int _height;
		}
	}
}
